 |
 |
 |
 |
#231805 - 01/05/03 01:20 AM
[6.2] Restore Lost Usernames to Old Posts (fix)
|
Member
Registered: 04/22/02
Posts: 231
Loc: Hamilton, Ontario, Canada
|
Script attached. It goes in your ubbthreads install directory, and you can delete it afterwards. [:"red"]You will require a backup from previous to the upgrade, specifically your w3t_Posts table. A new, renamed table (w3t_OldPosts) containing your old posts data is required - you will have to use PHPMyAdmin or some kind of tool or whatever to do this. Be sure and back up your current w3t_Posts table again just in case.[/] <br /> <br />I don't know if it's been noticed, but currently when you upgrade to 6.2, it deletes the Usernames from the w3t_Posts table, which means you lose the names of the people who posted stuff and had their username later deleted, because their username ID is 1 (appears as **DONOTDELETE**). <br /> <br />If you happen to have a backup of your w3t_Posts table (from 6.1.1 or earlier), with this script you can restore those lost names. You need to Restore your backup as w3t_OldPosts, then execute the script. <br /> <br />What it does is it grabs all posts that have been posted by Registed Users with the ID of 1, which means they were deleted. It takes their Username from the old table, and places it in the AnonName from the new table, and reflags them as unregistered posters. <br /> <br />When I ran it, it went through about 10,000 posts, and for some reason, some names could not be restored. Most were, though. Probably 90%. YMMV, but it's better than having **DONOTDELETE** everywhere. <br /> <br />If there are problems that you encounter, I'll watch this thread for replies. <br /> <br />Thanks! <br /> <br />ps. -demo of the result here: http://www.legendsoftacendia.com/forums/...amp;amp;fpart=1
Attachments
63662-fix.php.txt (28 downloads)
Edited by Dalar (01/06/03 06:16 PM)
_________________________
DalarLegends of Tacendia[]http://legendsoftacendia.com/forumimages/icons/troll.gif[/]
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#231814 - 01/06/03 06:04 PM
Re: Updated the script
[Re: beatdown]
|
Member
Registered: 04/22/02
Posts: 231
Loc: Hamilton, Ontario, Canada
|
I found what had caused some names to dissapear on my forum.<br /><br />When I first tried to upload a backup to the web, PHPMyAdmin couldn't handle it - 7 MB of POST data exceeds the maximum or something. So I cut down the backup on my computer to just those posts that were posted by those with registered usernames with PosterID of '1'.<br /><br />What I didn't realise until now, is that the backup I was using was old by about a month, which shouldn't matter when the posts I was concerned about were over a year old, except for the fact that I had deleted some users after this backup was done. So, that meant that when the script checked for one user that was recently deleted, it would find the correct condition to grab the username, except that the corresponding post wasn't even in the backup database because I had weeded out all registered users.<br /><br />So, if you have a full backup table, all should be fine. In my case, it was lacking, and it would just stick nullspace in the AnonName. My bad.. shouldn't affect others' results though.<br /><br />Carl, fromw hat I recall the setting for anon users should not matter. Either on or off, if it encounters something in the database recorded as an Anon it'll treat it as one. Are the B_Reged lines right?
_________________________
DalarLegends of Tacendia[]http://legendsoftacendia.com/forumimages/icons/troll.gif[/]
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|